# -*- coding: utf-8 -*-

from enum import Enum


class ValueType(Enum):
    NUMBER = 'NUMBER'
    OBJECT = 'OBJECT'


class ObjectType(Enum):
    STRING = 'STRING'


class Object:
    def __init__(self, object_type):
        self.type = object_type


class StringObject:
    def __init__(self, str):
        super().__init__(ObjectType.STRING)
        self.string = str


class Value:
    def __init__(self, value_type, value=None):
        self.type = value_type
        self.value = value

    def is_number(self):
        return self.type == ValueType.NUMBER

    def is_object(self):
        return self.type == ValueType.OBJECT

    def is_string(self):
        return self.type == ValueType.OBJECT and self.value.type == ObjectType.STRING

    def __repr__(self):
        return '<Value {}>'.format(self.value)


class NumberValue(Value):
    def __init__(self, value):
        super().__init__(ValueType.NUMBER, value)

    def as_number(self):
        return self.value


class StringValue(Value):
    def __init__(self, value):
        super().__init__(ValueType.OBJECT, StringObject(value))

    def as_string(self):
        return self.value.string
